package com.marshall.scstudy.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by
 *
 *
 * @author : Marshall
 * @datetime: 2021/11/9 15:18
 */
@Configuration
public class GatewayConfig {

    @Bean
    public RouteLocator routes(RouteLocatorBuilder routeLocatorBuilder){
        RouteLocatorBuilder.Builder routes = routeLocatorBuilder.routes();

        RouteLocator pathRouteMarshall = routes.route("path_route_marshall", r -> r.path("/guonei").uri("http://news.baidu.com/guonei")).build();

        return pathRouteMarshall;
    }

}
